#ifndef MULTISELECTCOMBOBOX_H
#define MULTISELECTCOMBOBOX_H

#include <QWidget>
#include <QListView>
#include <QStandardItemModel>
#include <QComboBox>

class MultiSelectComboBox : public QComboBox
{
public:
    explicit MultiSelectComboBox(QWidget *parent = nullptr);
    ~MultiSelectComboBox() override;
    void addItem(const QString &text,const QVariant &userData = QVariant());
    void addItem(const QIcon &icon,const QString &text,const QVariant &userData = QVariant());
    void addItems(const QStringList &texts);
    QStringList currentText();
    QList<int> currentIndex();

    QStandardItemModel *popupModel;
    QStandardItemModel *selectModel;
protected:
    bool eventFilter(QObject *watched,QEvent *event) override;
    void showPopup() override;
    void hidePopup() override;


private:
    bool isPermitHidePopup;
    QListView *selectItemView;
    QListView *popupView;
    void selectItemViewPress(QPoint pos);
signals:

};

#endif // MULTISELECTCOMBOBOX_H
